import axios from 'axios'

// 创建axios实例
const _axios = axios.create({});
_axios.interceptors.response.use(
    function (response) {
        return response.data;
    },
    function (error) {
        return Promise.reject(error);
    }
);

// https://apis.netstart.cn/zhihudaily/

// https://apis.netstart.cn/zhihudaily/stories/latest
// https://apis.netstart.cn/zhihudaily/stories/latest
// 记录服务器地址
const LATEST_URL = 'https://apis.netstart.cn/zhihudaily/';

// GET 方式
// 1、最新日报
export const latestDailyNewspaper = (data) => {
    return _axios.get(`${LATEST_URL}stories/latest`, { params: data })
}

// 2、历史日报
// https://apis.netstart.cn/zhihudaily/stories/before/:date
// stories/before/:date
export const storiesBeforeDate = (data = {}, mydate) => {
    return _axios.get(`${LATEST_URL}stories/before/${mydate}`, { params: data })
}

// 3、日报内容
// https://apis.netstart.cn/zhihudaily/stories/before/:date
// https://apis.netstart.cn/zhihudaily/story/9771619
// story/:storyid
// export const storiespages = (data = {},mynum) => {
//     return _axios.get(`${LATEST_URL}stories/${mynum}`, { params: data })
// }

export const storiespages = (data = {},myid) => {
    return _axios.get(`${LATEST_URL}story/${myid}`, { params: data })
}

export const storiespagescollect = (data = {},myid) => {
    return _axios.get(`${LATEST_URL}story/${myid}`, { params: data })
}

